package com.sunshine.lnuplusweb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class AboutController {

    @GetMapping({"/about", "/about.html"})
    public String about(HttpSession httpSession, Model model) {
        String userId = (String) httpSession.getAttribute("userId");
        if (userId != null) {
            model.addAttribute("login", true);
            model.addAttribute("userId", "欢迎 " + httpSession.getAttribute("userId"));
        } else {
            model.addAttribute("login", false);
        }
        return "about";
    }
}
